import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    privilege: 2,//0为普通用户，1为管理员，2为未登录
    username: '',
    //URL: "http://1.116.118.70:7000",
    URL: "http://localhost:7000",
    contractURL: "http://192.168.43.117:8088",
    projectURL: "http://192.168.43.119:8080"
  },
  mutations: {
    changePrivilege(state, val){
      state.privilege = val
    },
    changeUsername(state, val){
      state.username = val
    }
  },
  actions: {
    changePrivilegeAction(context, val) {
      context.commit('changePrivilege', val)
    },
    changeUsernameAction(context, val) {
      context.commit('changeUsername', val)
    }
  },
  modules: {
  }
})
